package com.xueyi.system.productDetection.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.xueyi.common.core.constant.basic.SqlConstants;
import com.xueyi.common.core.web.result.AjaxResult;
import com.xueyi.system.productDetection.domain.po.ProductDetectionPo;
import com.xueyi.system.productDetection.domain.query.ProductDetectionQuery;
import com.xueyi.system.productDetection.domain.dto.ProductDetectionDto;
import com.xueyi.system.productDetection.mapper.ProductDetectionMapper;
import com.xueyi.system.productDetection.service.IProductDetectionService;
import com.xueyi.system.productDetection.manager.IProductDetectionManager;
import com.xueyi.common.web.entity.service.impl.BaseServiceImpl;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * 产品检测管理管理 服务层处理
 *
 * @author zlf
 */
@Service
public class ProductDetectionServiceImpl extends BaseServiceImpl<ProductDetectionQuery, ProductDetectionDto, IProductDetectionManager> implements IProductDetectionService {


    @Autowired
    private ProductDetectionMapper productDetectionMapper;

    /**
     * 查询产品检测管理对象列表 | 数据权限 | 附加数据
     *
     * @param productDetection 产品检测管理对象
     * @return 产品检测管理对象集合
     */
    @Override
    //@DataScope(userAlias = "createBy", mapperScope = {"ProductDetectionMapper"})
    public List<ProductDetectionDto> selectListScope(ProductDetectionQuery productDetection) {
        return baseManager.selectListExtra(productDetection);
    }

    @Override
    public List<ProductDetectionPo> getInfo(String code) {

        QueryWrapper<ProductDetectionPo> queryWrapper = new QueryWrapper<>();
        queryWrapper.eq("plant_id",code);
        List<ProductDetectionPo> productDetectionPo = productDetectionMapper.selectList(queryWrapper);
        return productDetectionPo;
    }
}
